﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CustomerUC.ascx.cs" Inherits="ERP.PageUC.CustomerUC" %>
<%@ Register Src="~/PageUC/Customer_TypeUC.ascx" TagPrefix="uc1" TagName="Customer_TypeUC" %>
<%@ Register Src="~/PageUC/EnterpriseUC.ascx" TagPrefix="uc1" TagName="EnterpriseUC" %>
<%@ Register Src="~/PageUC/SectorUC.ascx" TagPrefix="uc1" TagName="SectorUC" %>
<%@ Register Src="~/PageUC/ContactUC.ascx" TagPrefix="uc1" TagName="ContactUC" %>
<%@ Register Src="~/PageUC/BankUC.ascx" TagPrefix="uc1" TagName="BankUC" %>

<script>
    $(document).ready(function () {
        PopupUpdate('#khachhang_themloaikhachhang');
        PopupUpdate('#khachhang_themloaidoanhnghiep');
        PopupUpdate('#khachhang_themnganhnghe');
        PopupUpdate('#khachhang_themnguoilienhe');
        PopupUpdate('#khachhang_themnganhang');
    });
</script>
<script>
    function CheckSaveCustomer() {
        var emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
        var kt1 = $('#<%=txtMaKhachHang.ClientID %>');
        var kt2 = $('#<%=txtTenKhachHang.ClientID %>');
        var allFields = $([]).add(kt1).add(kt2);
        var valid;
        allFields.removeClass("ui-state-error");
        valid = checkLength(kt1, "Mã khách hàng", 1, 50);
        valid = valid && checkLength(kt2, "Họ và tên", 1, 50);
        if (valid) {
            updateTips('');
            allFields.removeClass("ui-state-error");
        }
        return valid;
    }
</script>
<asp:UpdatePanel ID="upNewUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
    <ContentTemplate>
        <div class="btn-toolbar">
            <asp:Button ID="btnSavePopup" CssClass="btn-save btn-default" title="Lưu lại" runat="server" OnClientClick="return CheckSaveCustomer();" OnClick="btnSavePopup_Click" />
            &nbsp;
            <asp:Button ID="btnReloadPopup" CssClass="btn-reload btn-default" title="Tải lại" runat="server" OnClick="btnReloadPopup_Click" />
            &nbsp;
            <input type="hidden" id="lbID" runat="server" /><label class="validateTips"></label>
            <asp:UpdateProgress ID="upDateProcessUC" runat="server" AssociatedUpdatePanelID="upNewUpdatePanel">
                <ProgressTemplate>
                    <span class="label label-warning">Đang tải..</span>
                </ProgressTemplate>
            </asp:UpdateProgress>
        </div>
        <div class="ui-main" style="width: 973px;">
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Mã khách hàng :</label>
                <asp:TextBox ID="txtMaKhachHang" CssClass="textbox_child_text" runat="server" data-allow="add"></asp:TextBox>
                &nbsp;&nbsp;
                <label class="labelpopup">Loại khách hàng :</label>
                <asp:DropDownList ID="drLoaiKhachHang" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server"></asp:DropDownList>
                <a class="relationlink" onclick="return Show('#khachhang_themloaikhachhang');">...</a>
                &nbsp;&nbsp;
                <label class="labelpopup" style="width: 91px;">Tên viết tắt :</label>
                <asp:TextBox ID="txtTenVietTat" CssClass="textbox_child_text" runat="server"></asp:TextBox>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Tên khách hàng :</label>
                <asp:TextBox ID="txtTenKhachHang" Style="width: 486px;" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                &nbsp;&nbsp;&nbsp
                <label class="labelpopupnew">Loại hình DN :</label>
                <asp:DropDownList ID="drLoaiHinhDoanhNghiep" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server"></asp:DropDownList>
                <a class="relationlink" onclick="return Show('#khachhang_themloaidoanhnghiep');">...</a>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Tên tiếng anh :</label>
                <asp:TextBox ID="txtTenTiengAnh" Style="width: 486px;" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                &nbsp;&nbsp;&nbsp
                <label class="labelpopupnew">Hạn mức nợ &nbsp:</label>
                <asp:TextBox ID="txtHanMucNo" onkeypress="return ValidateKeypress(/\d/,event);" Style="width: 151px" CssClass="textbox_child_text" runat="server"></asp:TextBox>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Tên giao dịch :</label>
                <asp:TextBox ID="txtTenGiaoDich" Style="width: 486px;" CssClass="textbox_child_text" runat="server"></asp:TextBox>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Địa chỉ giao dịch :</label>
                <asp:TextBox ID="txtDiaChiGiaoDich" Style="width: 486px;" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                &nbsp&nbsp
                <label class="labelpopup" style="width: 105px;">Hạn TT :</label>
                <asp:TextBox ID="txtHanThanhToan" onkeypress="return ValidateKeypress(/\d/,event);" Style="width: 110px" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                <label class="labelpopup">ngày</label>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Tỉnh :</label>
                <asp:DropDownList ID="drTinh" AppendDataBoundItems="true" AutoPostBack="True" CssClass="textbox_child_text_drop" runat="server" OnSelectedIndexChanged="drTinh_SelectedIndexChanged"></asp:DropDownList>
                <a class="relationlink" onclick="return Show('#quanhuyen_themtinh');">...</a>
                &nbsp&nbsp
                <label class="labelpopup">Quận huyện :</label>
                <asp:DropDownList ID="drQuanHuyen" Enabled="False" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server"></asp:DropDownList>
                <a class="relationlink" onclick="return Show('#lienhe_themquanhuyen');">...</a>
                &nbsp&nbsp
                <label class="labelpopup" style="width: 121px;">Ngày thành lập :</label>
                <asp:TextBox ID="txtNgayThanhLap" CssClass="textbox_child_text_ngay" runat="server"></asp:TextBox>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Điện thoại 1 :</label>
                <asp:TextBox ID="txtDienThoai1" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                &nbsp&nbsp
                <label class="labelpopup">Điện thoại 2 :</label>
                <asp:TextBox ID="txtDienThoai2" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                &nbsp&nbsp
                <label class="labelpopup" style="width: 120px;">Fax :</label>
                <asp:TextBox ID="txtFax" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Website :</label>
                <asp:TextBox ID="txtWebsite" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                &nbsp&nbsp
                <label class="labelpopup">Ngành nghề :</label>
                <asp:DropDownList ID="drNganhNghe" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server"></asp:DropDownList>
                <a class="relationlink" onclick="return Show('#khachhang_themnganhnghe');">...</a>
                &nbsp&nbsp
                <label class="labelpopup" style="width: 121px;">Số tài khoản :</label>
                <asp:TextBox ID="txtSoTaiKhoan" CssClass="textbox_child_text" onkeypress="return ValidateKeypress(/\d/,event);" runat="server"></asp:TextBox>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Người liên hệ :</label>
                <asp:DropDownList ID="drNguoiLienHe" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server" AutoPostBack="True" OnSelectedIndexChanged="drNguoiLienHe_SelectedIndexChanged"></asp:DropDownList>
                <a class="relationlink" onclick="return Show('#khachhang_themnguoilienhe');">...</a>
                &nbsp&nbsp
            <label class="labelpopup" style="width: 85px;">Chức vụ :</label>
                <asp:TextBox ID="txtChucVu" Enabled="false" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                &nbsp&nbsp
                <label class="labelpopup" style="width: 121px;">Ngân hàng :</label>
                <asp:DropDownList ID="drNganHang" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server"></asp:DropDownList>
                <a class="relationlink" onclick="return Show('#khachhang_themnganhang');">...</a>
            </div>
            <div class="ui-box">
                <label class="labelpopup" style="width: 127px;">Điện thoại :</label>
                <asp:TextBox ID="txtDienThoai" Enabled="false" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                &nbsp&nbsp
                <label class="labelpopup" style="width: 85px;">Di Động :</label>
                <asp:TextBox ID="txtDiDong" Enabled="false" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                &nbsp&nbsp
                <label class="labelpopup" style="width: 121px;">Email :</label>
                <asp:TextBox ID="txtEmail" Enabled="false" CssClass="textbox_child_text" runat="server"></asp:TextBox>
            </div>
            <%-- Thông tin hoá đơn tài chính --%>
            <div class="Check1">
                <a>Thông tin hoá đơn tài chính</a>
                <div style="float: right; margin-right: 64px;">
                    <asp:CheckBox ID="chkCheck1" runat="server" AutoPostBack="True"/>Chỉnh sữa thông tin
                </div>
            </div>
            <div class="ChildCheck1">
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Tên đầy đủ :</label>
                        <asp:TextBox ID="txtTenDayDu" Style="width: 366px;" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                        &nbsp;&nbsp;&nbsp
                <label class="labelpopupnew">Địa chỉ :</label>
                        <asp:TextBox ID="txtDiaChiHopDong" Style="width: 300px;" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                    </div>
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px">Tỉnh - TP :</label>
                        <asp:DropDownList ID="drTinhHopDong" AppendDataBoundItems="true" AutoPostBack="true" CssClass="textbox_child_text_drop" runat="server" OnSelectedIndexChanged="drTinhHopDong_SelectedIndexChanged"></asp:DropDownList>
                        <a class="relationlink" onclick="return Show('#quanhuyen_themtinh');">...</a>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 85px;">Quận huyện :</label>
                        <asp:DropDownList ID="drQuanHuyenHopDong" Enabled="False" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server"></asp:DropDownList>
                        <a class="relationlink" onclick="return Show('#lienhe_themquanhuyen');">...</a>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 121px;">Mã số thuế :</label>
                        <asp:TextBox ID="txtMaSoThue" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                    </div>
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Người ký HĐ :</label>
                        <asp:DropDownList ID="drNguoiKyHopDong" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server" AutoPostBack="True" OnSelectedIndexChanged="drNguoiKyHopDong_SelectedIndexChanged"></asp:DropDownList>
                        <a class="relationlink" onclick="return Show('#khachhang_themnguoilienhe');">...</a>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 85px">Chức vụ :</label>
                        <asp:TextBox ID="txtChucVuHopDong" Enabled="false" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 121px;">Điện thoại :</label>
                        <asp:TextBox ID="txtDienThoaiHopDong" Enabled="false" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                    </div>
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Di động :</label>
                        <asp:TextBox ID="txtDiDongHopDong" Enabled="false" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 85px">Email :</label>
                        <asp:TextBox ID="txtEmailHopDong" Enabled="false" Style="width: 506px" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                    </div>
            </div>
            <div class="Check2">
                Thông tin giao nhận
                <div style="float: right; margin-right: 64px;">
                    <asp:CheckBox ID="chkCheck2" runat="server" AutoPostBack="True"/>Chỉnh sữa thông tin
                </div>
            </div>
            <div class="ChildCheck2">
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Đ/c giao nhận :</label>
                        <asp:TextBox ID="txtDiaChiGiaoNhan" Style="width: 796px;" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                    </div>
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Người nhận :</label>
                        <asp:DropDownList ID="drNguoiNhan" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server" AutoPostBack="True" OnSelectedIndexChanged="drNguoiNhan_SelectedIndexChanged"></asp:DropDownList>
                        <a class="relationlink" onclick="return Show('#khachhang_themnguoilienhe');">...</a>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 85px">Chức vụ :</label>
                        <asp:TextBox ID="txtChucVuNguoiNhan" Enabled="false" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 121px;">Điện thoại :</label>
                        <asp:TextBox ID="txtDienThoaiNguoinhan" Enabled="false" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                    </div>
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Di động :</label>
                        <asp:TextBox ID="txtDiDongNguoiNhan" Enabled="false" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 85px">Email :</label>
                        <asp:TextBox ID="txtEmailNguoiNhan" Enabled="false" Style="width: 506px" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                    </div>
            </div>
            <div class="Check3">
                Thông tin thanh toán
                <div style="float: right; margin-right: 64px;">
                    <asp:CheckBox ID="chkCheck3" runat="server" AutoPostBack="True" />Chỉnh sữa thông tin
                </div>
            </div>
            <div class="ChildCheck3">
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Đ/c Thanh Toán :</label>
                        <asp:TextBox ID="txtDiaChiThanhToan" Style="width: 796px;" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                    </div>
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Người thanh toán :</label>
                        <asp:DropDownList ID="drNguoiThanhToan" AppendDataBoundItems="true" CssClass="textbox_child_text_drop" runat="server" AutoPostBack="True" OnSelectedIndexChanged="drNguoiThanhToan_SelectedIndexChanged"></asp:DropDownList>
                        <a class="relationlink" onclick="return Show('#khachhang_themnguoilienhe');">...</a>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 85px">Chức vụ :</label>
                        <asp:TextBox ID="txtChucVuThanhToan" Enabled="false" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 121px;">Điện thoại :</label>
                        <asp:TextBox ID="txtDienThoaiThanhToan" Enabled="false" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                    </div>
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Di động :</label>
                        <asp:TextBox ID="txtDiDongThanhToan" Enabled="false" CssClass="textbox_child_text" onkeydown="javascript:backspacerDOWN(this,event);" onkeyup="javascript:backspacerUP(this,event);" runat="server"></asp:TextBox>
                        &nbsp;&nbsp;
                <label class="labelpopup" style="width: 85px">Email :</label>
                        <asp:TextBox ID="txtEmailThanhToan" Enabled="false" Style="width: 506px" CssClass="textbox_child_text" runat="server"></asp:TextBox>
                    </div>
                    <div class="ui-box">
                        <label class="labelpopup" style="width: 127px;">Ghi chú :</label>
                        <asp:TextBox ID="txtGhiChu" CssClass="textbox_child_text" Style="width: 796px" TextMode="MultiLine" runat="server"></asp:TextBox>
                    </div>
                <div class="ChildCheck3">
                </div>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnSavePopup" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
<div id="khachhang_themloaikhachhang" title="Cập nhật loại khách hàng">
    <uc1:Customer_TypeUC runat="server" ID="Customer_TypeUC" />
</div>
<div id="khachhang_themloaidoanhnghiep" title="Cập nhật loại doanh nghiệp">
    <uc1:EnterpriseUC runat="server" ID="EnterpriseUC" />
</div>
<div id="khachhang_themnganhnghe" title="Cập nhật ngành nghề">
    <uc1:SectorUC runat="server" ID="SectorUC" />
</div>
<div id="khachhang_themnguoilienhe" title="Cập nhật người liên hệ">
    <uc1:ContactUC runat="server" ID="ContactUC" />
</div>
<div id="khachhang_themnganhang" title="Cập nhật ngân hàng">
    <uc1:BankUC runat="server" ID="BankUC" />
</div>

